package at.ac.tuwien.dse.health.security;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 * @author Bernhard Nickel
 * @author Gregor Schauer
 * @author Dominik Strasser
 */
public class SecurityException extends RuntimeException{
	private static final Logger logger= LogManager.getLogger(SecurityException.class);

	public SecurityException(String message) {
		super(message);
		logger.warn(message);
	}

	public <T> SecurityException(String message,Class<?> required,Class<? extends T> provided,T roleObject) {
		super(message);
		logger.warn("Unauthorized action detected: User is in role "+provided+" but needs "+required+". Executing role object was "+roleObject);
	}
}
